﻿using System;

namespace PoolKit
{
    internal static class StopwatchFactoryExtensions
    {
        public static IStopwatch CreateAndStart (this IStopwatchFactory stopwatchFactory)
        {
            if (stopwatchFactory == null) throw new ArgumentNullException("stopwatchFactory");

            var newStopwatch = stopwatchFactory.Create();
            newStopwatch.Start();

            return newStopwatch;
        }
    }
}